<template>
	<view>
		<view class="a1">
			<text>投诉公司:百世快递</text>
		</view>
		<view class="a2">
			<text>运单号：</text>
			<input placeholder="请输入运单号" v-model="no"/>
		</view>
		<u-line></u-line>
		<view class="a2">
			<text>投诉类别：</text>
			<input placeholder="请输入投诉类别" v-model="type"/>
		</view>
		<u-line></u-line>
		<view class="a2">
			<text>投诉内容：</text>
			<input placeholder="请输入投诉内容" v-model="content"/>
		</view>
		<u-line></u-line>
		<u-button type="primary" text="确认" @click="tousu"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				no:'',
				type:'',
				content:'',
				id:0
			}
		},
		onLoad() {
			this.getid()
		},
		methods: {
			getid(){
				this.api.get('/prod-api/api/logistics-inquiry/logistics_info/ST0000001').then(res=>{
					this.id=res.data.data.company.id
					this.no=res.data.data.infoNo
					console.log(this.no)
					console.log(this.id)
				})
			},
			tousu(){
				if(this.no===''||this.type===''||this.content===''){
					uni.showToast({
						title:'参数错误',
						icon:'error'
					})
				}else{
					const  data={
						companyId:this.id,
						infoNo:this.no,
						questionType:this.type,
						description:this.content
					}
					this.api.get('/prod-api/api/logistics-inquiry/logistics_complaint','POST',data).then(res=>{
						if(res.data.code===200){
							setTimeout(function(){
								uni.showToast({
									title:'投诉成功'
								})
							},700)
							uni.redirectTo({
								url:'/pages/other/wuliu/wuliutousu/wuliutousu'
							})
						}else{
							uni.showToast({
								title:'投诉失败',
								icon:'error'
							})
						}
					})
				}
			}
		}
	}
</script>

<style lang="scss">
.a1{
	font-size: 28px;
	text-align: center;
}
.a2{
	display: flex;
	margin-top: 20px;
	margin-bottom: 20px;
}
</style>
